<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="geral" />

</head>
<body>
	<g:hasErrors bean="${usuario}">
		<g:eachError var="err" bean="${usuario}">
			<div class="alert alert-danger alert-dismissable">
				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
				<g:message error="${err}" />
			</div>
		</g:eachError>
	</g:hasErrors>
	<div class="row">
  		<div class="col-md-6 col-md-offset-3">
  			<h3>Alterar Perfil</h3>
			<g:uploadForm action="atualizarPerfil" role="form">
				<div class="form-group">
					<label for="nome">Nome</label>
					<g:textField name="nome" class="form-control" value="${usuario?.nome }"/>
				</div>
				<div class="form-group">
					<label for="nome">Email</label>
		  			<g:textField name="email" class="form-control" value="${usuario?.email }"/>
				</div>
				
				<g:if test="${usuario.foto?.id}">
					<div class="form-group">
						<img src='${createLink(controller:'documento', action:'recuperar', id:"${usuario.foto.id}")}' alt="Foto do Perfil" 
							class="img-rounded" style="width: 150px; height: 200px;"/>
					</div>
					<div class="form-group">
						<p class="help-block"><g:link controller="usuario" action="removerFoto">Remover foto</g:link></p>
					</div>
				</g:if>
				<g:if test="${!usuario.foto?.id}">
					<div class="form-group">
						<label for="exampleInputFile">Foto</label> 
						<input type="file" name="arquivo">
						<p class="help-block">Insira sua foto do perfil.</p>
					</div>
				</g:if>
				<div class="form-group">
					<label for="senha">Senha Atual</label> 
					<div class="row">
				  		<div class="col-md-5">
				  			<g:passwordField name="senha" class="form-control"/>
				  		</div>
				  	</div>
				</div>
				<div class="form-group">
					<label for="novaSenha">Nova Senha</label> 
					<div class="row">
				  		<div class="col-md-5">
				  			<g:passwordField name="novaSenha" class="form-control"/>
				  		</div>
				  	</div>
				</div>
				<div class="form-group">
					<label for="novaSenhaConfirm">Confirmação Nova Senha</label> 
					<div class="row">
				  		<div class="col-md-5">
				  			<g:passwordField name="novaSenhaConfirm" class="form-control"/>
				  		</div>
				  	</div>
				</div>
				<g:submitButton name="upload" class="btn btn-primary" value="Atualizar Perfil" />
			</g:uploadForm>
		</div>
	</div>
</body>

</html>
